<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('images', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('type')->comment('类型: 1-商品封面; 2-商品图片; 3-SKU封面; 4-SKU图片; 5-优惠券图片; 6-轮播图; 7-通知图片');
            $table->integer('type_id')->comment('类型ID');
            $table->string('checksum')->comment('图片MD5');
            $table->string('path')->comment('存储路径');
            $table->string('host')->nullable()->comment('图片 HOST');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('images');
    }
}
